LEGO® MINDSTORMS(tm) Internals

A note to the reader: some of these links may be unreachable. I'm leaving them here if only to give credit where credit is due. Newer items are added to the bottom of each section, so look there for news.

The LEGO® MINDSTORMS(tm) (#9719) product is a robot-kit-in-a-box. It consists of a computer module (the "RCX(tm)"), and an inventory of many TECHNICS(tm) parts. It appears to be a productized version of the MIT Programmable Brick, as the following table will show you.

boxsizesensorsmotorsurl
Cricket:4x622url
RCX:8x1233url
Brick:9x1364url

The LEGO-Robotics Mailing List

A group of people have figured out how to talk to the RCX from operating systems unsupported by The LEGO Group. Wired Online has noticed us.

This group of people gathers at the lego-robotics mailing list. You may subscribe to this list by sending a subscription request. Nothing special is needed in the subject or body of the message. You can also get off the list. You can also read the mailing list via HTTP (web pages) or via NNTP at LUGNET, and if you want to receive messages in digest format, LUGNET also offers news-by-mail delivery with several digest options.

General MINDSTORMS Info

You can buy the MINDSTORMS RIS (Robotics Invention System) at the stores listed below (presuming they have it in stock), and many fine toy outlets. Also available are RIS extension kits. Also available are two other, less capable, MINDSTORMS sets: RDS and DDK. Fred Martin has a robot builder's guide.

Places to buy MINDSTORMS (not a comprehensive list):

Erik Brok has an introduction to programming with MINDSTORMS page.

Kin W. Lau has a page of resources for using MINDSTORMS in education. Franz-Michael S. Mellbin has one also.

Books

Jonathan Knudsen has written an O'Reilly book on LEGO MINDSTORMS. You can buy it at Amazon. He's got a bunch of links to LEGO and MINDSTORMS resources.

Michael Gasperi has, with Dave Baum, Ralph Hempel, and Luis Villa, written a book entitled Extreme MINDSTORMS.

Joe Nagata's LEGO MINDSTORMS Idea Book

Mario and Giulio Ferrari, with Ralph Hempel as technical editor, have written Building Robots with LEGO MINDSTORMS.

Core LEGO MINDSTORMS Programming: Unleash the Power of the Java Platform by Brian Bagnall

Jin Sato's LEGO(r) MINDSTORMS(tm): THE MASTER'S TECHNIQUE is an excellent teaching book on the details of how to put lego pieces together in ways you may not have thought of before; ultimately those techniques are used to create MIBO, a dual-RCX, six motor dog. Slashdot Review.

Jim West has a page covering Mindstorms Books.

Notes

Todd Graham is working on a remote-control and remote-viewing robot he calls a Telerobot.

Cindy Salwen pointed out a description of the protocol for the serial interface between the computer and the Dacta Control lab. This may or may not be related to the protocol used by the RCX, but if you're reading this page, it's probably interesting information anyway. She also contributes another URL: National Instruments (LabVIEW) pages. Robolab is available for sale from Pitsco.

Fred Martin, arguably the father of the RCX (well, given that LEGO redesigned the Programmable Brick from the ground up for production reasons, the *grand*father), has a page on LEGO MINDSTORMS.

Kekoa Proudfoot says "toast that warranty!" He took apart his RCX and took some pictures of the inside of it. He also looked up the numbers for some of the chips. Peter Ljungstrand bought a CyberMaster kit, disassembled the main unit, and took pictures.

Patrick R. Gili has some notes on disassembling the RCX

Dave Baum says that RCX to RCX communication is pretty simple. There's a low level command in the RCX to send a message which contains a single 8 bit number as payload (plus the protocol "wrapper"). The RCX also remembers the last "message" it has seen, and this value can be used to make decisions. Pretty basic stuff, but still enough to do some reasonable things.

Dave also talks about the various LEGO motors. The motors that come with MS are the 5225 Gear Motor. Such motors may be purchased at LEGO Shop at Home. Philippe Hurbain has compared Lego 9 volt motors.

Dave is also "pretty sure" there are 32 global variables that can be used in RCX coding.

Peter Liu says that "Do you byte, when I knock?" is the key to UnlockFirmware().

Jonathan Woodward was curious about which colors of LEGO reflect infrared the best.

Matt Jadud and Greg Hanek at Indiana University are doing a lot with LEGO Robots.

So are Carlos Raez and Brenda Groff of the Fort Wayne campus.

Some students in a Luxembourg boarding school have a LEGO MINDSTORMS users' group called Robobull.

Dean Husby has building instructions for a device which expands the RCX's I/O called the (MS)2 Expander

ELPMIS trains students in Singapore in Lego Mindstorms, robolab and also RIS.

Building

Jim Studt built a public Magic 8 Ball. Enter your question and press the Ask button, and you see a video of an RCX spinning the 8 ball, along with the final answer that floats to the top.

René Schalburg wrote Creating a Spider Robot using LEGO-MINDSTORMS.

Doug Carlson has a four-wheel synchro robot which can move in any direction. He uses two angle sensors (available from Pitsco/Dacta), and can make it move in a perfect square.

Wes Matchett built a different type of synchro drive.

Gavin Smyth has pictures of a walker that uses universal joints to make the leg rods "bend".

Alex Wetmore built a robotic platform using the plans for the adder/subtracter found on Leo's LEGO. The platform allows you the robot to get the normal four motions (forward, reverse, spin left, spin right) with a perfectly straight forward and reverse. One of the motors is used to move the robot forward and backwards. To turn the robot left and right you use the other motor.

Fredrik Glöckner created a triple gait cycle hexapod using the CyberMaster. He has other TECHNICS models.

Bill Clagett has a few TECHNICS and MINDSTORMS creations.

Robert Fay has posted pictures and a QuickTime movie of his new vertical mill.

Ben Erwin has the only site with K-12 RCX-related lesson plans (that he knows of).

Henrik Hautop Lund is the head of LEGO Lab at the University of Aarhus.

Ben Williamson has built several robots, including:

The FetchBot searches for dark objects to grab, lift and deposit elsewhere. The grabber and the arm are driven by one motor. The page includes an animation of the arm grabbing a block, and photos of the gearing and cams that make it work.

The Truck is a robotic tractor-trailer vehicle with rack-and-pinion steering. The tractor contains sensors and the steering and drive motors, while the trailer carries the RCX controller and an earthmover. The Truck can back up in a straight line by using the sensors to determine if the trailer is off centre.

BTW, he got some fun feedback from The Probe robot that he posted earlier, including mail from someone who works for Digital Instruments. Apparently they hold the patent on the technique that his robot uses, they just do it on a somewhat finer (nano) scale. Sounds like a theme for a competition: how many patents can you infringe using LEGO? :)

Rich Thompson has been playing around with the "radar" created by using IR messages and has posted some pics and code examples (in BotCode since the C skills are rusty, and BotCode feels more like assembly...).

Chris Stanley made a radarbot by transmitting IR data.

Dave Astolfo has pics of a Fire Extinguisher. It seeks out candlelight, and blows it out.

Simen Svale Skogsrud built a LEGO-scanner. He also put in descriptions and code examples for proximity-detection and using the FOS-light unit as a rotation sensor. Be welcome. No actual pictures of LEGO creations yet, but lots of attractive illustrations.

Michael Powell's directional transmission shows one way to do different things based on the direction of the motor.

Mario Ferrari built a two-legged walker

Jin Sato has made some nifty robots.

Linda Hamilton is doing lots of things with her math classes.

Brian Cooper builds combat robots called InfraDreadnaughts. He demonstrated them at the MIT MindFest.

David Mattison has done some work on improving the IR Radar capabilities, and he's also designed a robot similar to Ben Williamson's probe, but scanning the ceiling.

As a group project at Loughborough University we have been developing an autonomous explorer robot using LEGO MINDSTORMS. The results of this years work are now complete. From this link click on the 'planetary explorer project'.

In March Chris Busse ran a MINDSTORMS maze running competition for a company gathering, "Geeks at the Beach" in Miami. 16 teams from different cities in 4 countries participated! Each team was given a MINDSTORMS kit, rules, and three weeks to prepare a robot that could navigate one of three possible maze routes. Pictures and rules are available.

Jennifer Clark built four TECHNIC creations: a dumpster carrier, a mini excavator, a skid steer loader and a mobile crane, which received rave reviews on the mailing list.

A Lego-robot with camera controlled by Matlab. The project goal was a robot that is controlled by Matlab in realtime using the cameras signal as input, combining image analysis and robotics.

Interesting robot with pneumatic lifts and a wireless webcam. It's controlled via a cellphone over bluetooth to a Palm PDA talking to the RCX via IR.

Heroes

Kekoa Proudfoot has done the work to figure out the opcodes in the packets, which seem also to be the programming opcodes as well! He is a minor deity!

Programming

The LEGO MINDSTORMS Group has an official SDK. This Technical Reference document tells you how to use SPIRIT.OCX directly to write LEGO MINDSTORMS RCX or LEGO TECHNIC CyberMaster programs, providing more detailed control over the LEGO Programmable Bricks.

Thomas Dow is using his HP-100LX to generate RCX IR codes.

Bjarne Rene has made a web page on how to make a C++ program that can communicate with the RCX.

Paul Haas has a Perl program to talk to the RCX from a Linux box.

Owen Stenseth has some RCX perl tools, to disassemble RCX opcodes.

Dave Baum has a simple C-like language called NQC (Not Quite C) that can be used to program the LEGO RCX. It runs on Windows, Macintosh, Linux, and OS/2.

Brian Connors has written NQCIPC, very simple interprocess messaging package for NQC for use on MINDSTORMS and Cybermaster. It provides semaphore services and a simple intertask messaging system, all implemented as NQC macros.

Kekoa has IRIX source for a very simple Unix tool for communicating with the RCX.

Laurent Demailly has written TclRCX.

Dario Laverde developed the first 100% Java API for the RCX. This RCX Java API Library is available with source code and example applications.

Tramm "Foo" Hudson has a program to download firmware into the RCX.

Eric Brok has made a Visual Basic program (for Windows) that allows him to control the RCX and download certain programs. The program is called Mind Control. Mind Control can be used to interprete the user's own text files (with Spirit commands).

Sean Hearne and David Hanley at the Waterford Institute of Technology, Ireland, have put together a course for programming the RCX with Visual Basic.

Gary Kacmarcik has written a H300 disassembler in Perl. This script takes the firm0309.lgo file (which you'll need to copy from your MINDSTORMS CD) and a separate comment file, and merges the output of the disassembly with the comment file to produce a commented disassembly.

There's a shareware BotCode program. Don't know much about it.

Gordon's Brick Programmer is an alternative visual programming interface for MINDSTORMS. It provides a folding editor, symbolic variables, access to the RCX data log, a simple debugger and its free!

Brian Cwikla has written a program editor/tester/debugger that allows you to write programs for the RCX with all the functions listed in the MINDSTORMS SDK and not have to know VB.

Mark Overmars has created the RCX Command Center for Windows. It's a program that assists you in programming the LEGO MINDSTORMS Robots. It provides a higher level interface to the RCX, the programmable brick that forms the heart of the LEGO Robots. John Hansen has made some changes to his version.

A new web page with examples of RCX programming using ROBOLAB.

Peter Hesketh wants to program the RCX in MS QBasic under DOS. He has written two programs so far: a talkrcx and a firmware download, both of which will work on any PC with DOS and QBasic.

Andy Bower has written Bot-Kit, an interactive object oriented environment for the RCX and Cybermaster using the Smalltalk programming language. It uses the Spirit OCX as a base and runs under Win95/98 and NT4 systems.

Ralph Hempel has a firmware replacement which runs forth, called pbFORTH. pbForth has a GUI.

Ralph also has a suite of Tcl/Tk tools for the RCX.

Malcolm S Powell has written Gordon's Brick Programmer as a replacement for the MINDSTORMS Programming Environment. Tree view based instead of blocks: point and click to add commands, drag to move them, allows variables, and nested loops. No C or Visual Basic programming required!

Chris Stanley has a utility called RCX Interrogator. It will (hopefully) tell you everything there is to know about the state of your rcx: variables, sensors, motors, memory map and more.

Nick H. has written WebSpirit, which enables you to control the RCX Via the ActiveX Control, and JavaScript

Richard Maynard has written Brainstorm which is a UCBLogo version for MINDSTORMS. Win95/NT.

Denis Cousineau is distributing RCX_command. RCX command is a program editor for the LEGO RCX programmable brick. Using RCX command, you can build programs, and download them to the RCX. You can also send immediate command (ex. PlaySystemSound, or PBTurnOff). You can also retrieve information from the RCX using commands such as Poll, or MemMap. RCX commands are compatible with the LEGO SPIRIT.OCX library. Complete documentation is available on the LEGO MINDSTORMS web site.

Kekoa's librcx is intended to be a lowest-level driver for the LEGO RCX. It provides an interface between your C code and the ROM. The intent is to allow you to easily explore the ROM interface. It is also possible to use this code as a starting point for writing something more sophisticated, along the lines of LegOS. Librcx requires the GNU H8 development environment.

Scott Lewis has a 100% pure Java interface for communicating with the RCX. It provides an object-oriented interface for downloading tasks/subroutines into the RCX, as well as sending arbitrary RCX commands. Source included with GPL license.

David Van Wagner has written code to write simple programs onscreen using the RCX buttons. Version 1.0 contains only enough functionality to be useful. Gotos, Outputs, and Delays are implemented with a maximum of 16 instructions. Later releases should have more functionality."

Jan Newmarch wrote a Jini/MINDSTORMS driver as part of his Jini tutorial.

Aviv Eyal has been programming his RCX using Java and Visual J++ 6.0 COM features. He's generalized the code so others may use his classes to program RCX programs (tasks+subroutines) from Java. He calls it MJSDK - MINDSTORMS Java Software Development Kit.

Mitchell 'the dude' Wagner and a fellow CS major at Indiana University have been working on a version of Scheme for the LEGO Robots.

Jose Solorzano has a JVM for the RCX. He also is working on leJOS.

John C. Quillan has a perl module to allow you to communicate with your RCX, called LEGO::RCX.

Daniel Berger has an interface in VC++ which accesses the serial port directly (without the spirit.ocx). It also describes how to enable streaming video input in VC++ and how to use the video image to control the robot.

Jos van Kempen has made a spirit2.ocx with most of the functions from spirit.ocx but for RCX2.0 and USB.

legOS

Markus L. Noga has written some replacement firmware: legOS-0.1. legOS allows you to program the LEGO MINDSTORMS RCX in assembler and standard C. Beyond the bytecode barrier, arrays, structures, pointers and arbitrary user-defined data types await.

Luis Villa has written a legOS HOWTO.

Dave Madden has a web-based compiler for legOS. Drop your C/C++ code into a form, press submit, and you get back a link to the compiled code.

Marco Beri and Mario Ferrari just released the first version of emulegOS, a software emulator of legOS and the RCX itself. Emulegos is C/C++ code to compile and link together with your own legOS code. So it's not an application but requires a development system. Our first version runs under the Borland C++Builder IDE, but we put a great effort in keeping the code as much portable as possible, so it shouldn't be a pain to move it to other platforms/compilers. We'll appreciate anybody's help in this.

Barry Fagin is teaching robotics programming using ADA and the MINDSTORMS system.

Jason Gilder's Computer Engineering senior design project was spent creating a new programming language for the Lego Mindstorm. It uses Asynchronous State Machine (ASM) charts to illustrate the behavior of the robot.

TinySoar is an implementation of the Soar artificial intelligence architecture that is intended to run on a memory-constrained device, like a robot.

Common Lisp and Scheme implementations for Mindstorms. Marc Feeley of the Universit=E9 de Montr=E9al specialises in embedded Scheme interpreters (extremely small footprint) suitable for Mindstorms.

Peter Whalley has developed a language for the RCX called actor-lab. It's a parallel, object-orientated control language designed to introduce the ideas of control technology and robotics in the classroom. It's a zero-cost download for Mac and PC.

Communication

The RCX uses a 38kHz carrier, which is pretty typical for TV remotes. As for the sampling rate, the RCX runs at 2400 bps, which makes each bit approx 417us. Sony remotes (which aren't the fastest), use pulse widths of 600us and 1200us, so we're in the right ball park. I think a learning remote would do pretty well.

Peter Middlestorb reports that a learning remote does indeed work. He used a Casio Model 1174 CMD-40 watch.

Robert Eddings says that the OmniRemote successfully learned and played back the LEGO MINDSTORMS command codes. He has a page with a trained OmniRemote.

Pacific Neotek have released the OmniRemote Development Kit, and RoboRemote, which gives you simple and complete control over your LEGO Scout and RCX MINDSTORMS (like the official MINDSTORMS Remote Control) with an IR-enabled PalmOS device.

The IR protocol associated with sending a "message" to the RCX is pretty simple. Bit encoding is 2400 bps, NRZ, 1 start, 8 data, odd parity, 1 stop bit. A '0' is coded as a 417us pulse of 38kHz IR, a '1' bit is 417us of nothing.

At the packet level, all packets look like this:

0x55 0xff 0x00 D1 ~D1 D2 ~D2 ... Dn ~Dn C ~C
where D1...Dn are the message body, and C = D1 + D2 + ... Dn.

The data for sending an IR message is F7 followed by the 8 bit "message". For example:

55 ff 00 f7 08 12 ed 09 f6
is a packet sending the message "0x12" to the RCX.

Kekoa writes:

The scheme used to transmit data results in an equal number of zero bits and one bits, allowing a receiver to compensate for a constant signal bias (caused by ambient light) simply by subtracting the average signal value. Note that the header also has an equal number of ones and zeros; this warms up the receiver before the real data arrives.

The data portion of each message starts with an opcode. An opcode is either a request (PC to RCX) or a reply (RCX to PC). Requests have 0x80 clear, replies have 0x80 set. The reply corresponding to a given request is the request's complement and vice-versa. Opcodes seem to come in pairs; that is, there are two opcodes to specify each request, and there are two opcodes to specify each reply. These "dual" of a given request or reply opcode is the exclusive or of that opcode with 0x08.

Example:

Op 0x10 Alive Request / Op 0xef Alive Response
Op 0x18 Alive Request / Op 0xe7 Alive Response
0x10 and 0xef are complements
0x18 and 0xe7 are complements
0x10 and 0x18 differ only in 0x08 bit
0xef and 0xe7 differ only in 0x08 bit

Dave believes the IR device loops back DTR/DSR, and the PC software uses this to detect if the IR device is attached.

Kekoa has a trace of a firmware download session.

Vadim Strizhevsky and Owen Stenseth have a program which lets you send and receive packets from RCX on a Palm Pilot via serial line. It can also decode/encode the packets and find out if RCX is on-line.

Mike Kory wrote a Palm Pilot program to control the RCX through a serial cable connected to the RCX's IR tower.

Len Holgate tells us about WebRemote. The WebRemote Device Controller allows you to control devices across a NetMeeting connection. If you have devices to control then you simply run the device controller, add the drivers for your devices and connect to NetMeeting to make the devices available. If you want to control someone's devices then just run the device controller and connect to NetMeeting. Once connected available devices will be displayed. You can select a device to control and if you don't have the appropriate controller installed you can download it from the web automatically.

Kevin Gott has developed a program called Remote Control X that allows someone to control their RCX by using a game contoller via the infrared transmitter.

Mindstorms IR-communication, by Stef Mientki, written May 2001.

Michael Brownjohn write a server in VB using Winsock and spirit2.ocx, to allow people to send commands over a network to the server, to then control an RCX 2.0.

RC commands

Lu contributes the following table of RC commands:
Command Parameter(s) Vague explanation
On (outport A/B/C) turn on one or more things connected to port(s) A, B or C
OnFor (outport A/B/C)(time in tenths of a second or random)
Off (outport A/B/C)
SetPower (outport A/B/C)(1=low to 8=max)
SetDirection (outport A/B/C)(left or right)
ReverseDirection(outport A/B/C)
Wait (time in tenths of a second) possible values are 1-3276
Beep (sound type 1 to type 6)
Tone (frequency)(time in tenths of a second) possible frequency values are 0-20000 (a chart shows places middle C at 523) possible time values are 1-25
ResetCounter set the built in counter to 0
AddToCounter adds 1
ResetRotation (inport 1/2/3) to 0 if an angle sensor is connected
ResetMessage clears a received IR message
ResetTimer reset to 00:00
SendToRCX (integer 1 to 255) send IR message to another RCX
Flow control
Check&Choose (sensor 1/2/3)(True/False) pick sensor(s) connected to port 1, 2, or 3 and check the status
Check&Choose (counter/timer/RCX)(value range)(True/False) here's where you check for a message from another RCX
Repeat (integer or random)
RepeatForever moms just hate this
RepeatWhile touch sensor (1/2/3) repeat while sensor is pressed
" timer (0-3276) while timer value = preset val
" counter (0-32767) "
" RCX (1-255) while message val = preset val
" light sensor (1/2/3)(dark range/bright range) there are 2 ranges with a total range from 0-100
WaitUntil (sensor 1/2/3) until sensor condition is true
Sensor Watchers
Touch (sensor 1/2/3)(pressed/released)
Light (sensor 1/2/3)(dark value range/bright value range)
Rotation (sensor 1/2/3)(0 to 160)(forward/backward) 16 counts per rotation
Temperature (sensor 1/2/3)(cold value range/warm value range) C or F
Counter (range from value/to value) 0-32767
Timer (range from value/to value) in tenths of a second 0-3276
RCX (range from value/to value) 1-255

CPU

Kekoa writes:

Here are the specs on part number HD6433292, which you can see in the picture of the bottom of the circuit board:
Series H8/3297
Product name H8/3292
Part number HD6433292
ROM size 16K
RAM size 512
Speed 16MHz @ 5V
8-bit Timers 2
16-bit Timers 1
A/D Conversion 8 8-bit
I/O pins 43
Input only pins 8
Serial port 1
10mA outputs 10

Thanks to Patrick Gili for pointing Kekoa toward the Hitachi page with pointers the chip's manual in various formats.

Sensors

Rotation and temperature sensors are available from Pitsco.

Dave Baum relates: The rotation sensor works very well for this sort of thing. Its "raw" value is one of 4 analog voltages, each of which correspond to a 22.5 degree segment within a quadrant. Simply based on raw readings, it is impossible to tell which quadrant the sensor is in. However, the RCX firmware samples this sensor quite frequently and can keep track of how many quadrants have been "moved through". The end result is a reading that tells you the number of revolutions in 1/16 of a revolution increments. Sample rate is good...I have been able to use the sensor directly on the "gear" motor and not miss any rotation. In one of my models I then geared down the motor by a worm -> 24t and a 8t -> 24t gear reduction. The result was I could measure the position of the gear reduced "arm" at better than 1/3 a degree.

Frank Angeli disassembled his light sensor. He has pictures, too. Michael Gasperi figured out the light sensor schematic.

Malcolm S Powell has devised a simple optical sensor that can sense linear motion or rotation.

Wes Matchett has been working on constructing a touch sensor from parts of old devices. He discovered that the micro switches from a MS mouse and a Logitech mouse are the exact width of the inside dimensions of a 2x LEGO brick. Here are the instructions and two pics of the results. The price is right, $0.00

DCPMicro has some sensors for sound, voltage, temperature, pH, angular position, humidity and air pressure. They have created an interface to make them work with the RCX.

Wes Matchett constructed an IOExtender that uses relays to increase the number of sensors & motors the RCX can use. The IOExtender connects the RCX to a total of 6 sensors and 4 motors, if this design is pushed to its limit. This version is designed to allow the RCX to control the syncro drive mentioned above.

Dan L says "You can place a 1X2 beam in front of the light sensor. This blocks the LED but not the sensor."

Don Hewitt has built a rotation sensor from the Extreme Creatures Fiber Optic parts.

Bert van Dam has a page for his robots, and homemade sensors. He also has data and programs in Visual Basic.

Likewise for Michael Gasperi, who has a MINDSTORMS page that talks about how the sensors work, as well as some building he's done, in particular, a recreation of Gray Walter's robotic turtle. He also has a book entitled Extreme MINDSTORMS, written with Dave Baum, Ralph Hempel, and Luis Villa.

Michael Nielsen has some great info about implementing RCX sensors.

Dennis Clark has a homemade sensor to do IR proximity detection.

Peter Smolders has some homemade sensors and a hexapod robot.

HiTechnic manufactures a range of sensors, controllers, and mechanical accessories for robotic projects, many of which are compatible with LEGO MINDSTORMS products.

Some folks at Trinity College in Hartford, CT that created a custom sensor for an IR distance sensor. No more banging into walls to detect them!

Many many lego-compatible sensors are available from Mindsensors. They use a PCB with brick-compatible holes that plugs into a connector brick. Excellent stuff here.

Hardware

Chip numbers, as discerned (with a magnifying glass!) by Kekoa, with some additions from Martin Legault and Mark Bellis. Mark has reverse-engineered schematics for the IR tower[Brickshelf], RCX power supply[Brickshelf], and RCX sensor interface[Brickshelf]. Well done, Mark.

Numbers for elements on the top (LCD side) of the board (power connector on the right), moving generally from left to right:
2 IR LEDs ?
1 IR receiver TK19 / TFM. / 749 / 1380
1 The CDC-P83 is an NPN transistor, type BCX68-25, 20V, 2A, hfe=250, pin-out ECB, tab=Collector CDC / P83
8 PNP transistors scattered on left half BC858B
3 NPN transistors scattered on left half BC848B
1 capacitor to right of IR receiver leads 4.7uF
3 red cylinders w/ two black lines, two leads diac
5 resistors, yellow label on black 10K
1 resistor, yellow label on black 1M
5 resistors, yellow label on black 2.2K
1 resistor, yellow label on black 22K
3 resistors, yellow label on black 3.3K
3 resistors, yellow label on black 39
1 resistor, yellow label on black 47K
3 resistors, yellow label on black 10K 1%
1 resistor (?), yellow label on black IRD (?)
1 resistor (?), white label on green 560
3 Probably capacitors for power line filtering ?
1 LCD display ?
1 speaker (under LCD) ?
1 LCD controller (under LCD) PCF8566T / 61875 / YSM98061
1 metal can capacitor, 100uF H2 / 100 / 16V
1 voltage regulator LM2936M-5
1 power connector 8 (on back) / 22 (on top)
12 scattered brown boxes are capacitors ?
24 scattered diodes SM 4002
12 clips ?

Numbers for elements on the bottom (microcontroller) side of the board (power connector on left), moving generally from left to right:
1 small chip, leftmost on board, zener diode, 6.8v Z5 / P / 7d
1 N-channel MOSFET with schottky flywheel diode, type RFD3055LESM (Fairchild)F3055L / H7 / 01
1 tantalum cap 10uF, 6V
2 small chips, right of 3055, three leads 3K / P / 81
1 gray box, two leads ?
3 motor controllers (?), 16 leads ELEX 10402B / 9980A 4597
1 bank of three input NAND gates, 14 leads 74HC10D
1 small chip beneath 74HC10, zener diode, 6.2v Z4p
1 small chip above right of 74HC10, three leads 1K / P / 82
1 bank of flip flops, 20 leads 74HC377D
1 crystal, above microcontroller 16Mhz
1 small chip above microcontroller, three leads P 005
1 microcontroller, 64 pin QFP HD6433292B02F
1 RAM, 32K (?), 28 pins D43256B60-70LL / 9752XD077
1 capacitor, upper right, two leads 4.7uF
1 small chip, right edge center, three leads 3K / P / 81
1 small chip, right edge bottom, three leads 1K / P / 82
1 resistor, yellow label on black 10
1 resistor, yellow label on black 100
1 resistor, yellow label on black 10K
10 resistors, yellow label on black 100K
1 resistor, yellow label on black 12K
1 resistor, yellow label on black 150K
4 resistors, yellow label on black 22K
1 resistor, yellow label on black 220K
1 resistor, yellow label on black 330
1 resistor, yellow label on black 390K
6 resistors, yellow label on black 47K
1 resistor, yellow label on black 470K
4 brown boxes, two leads ?

Paul Haas has figured out that the RCX generates a signal which can control a servo. His Hitec HS-300 servo responds to 1 millisecond (ms) pulses by rotating to one extreme and 2 ms pulses by rotating to the other extreme. You can make the RCX generate pulses like that. It takes 3 resistors to get the voltage right and the wave form shape clean enough. His Servo is only rated up to 6 volts, so he used 4 AA batteries for it. Now the servo goes to either extreme under the direction of the RCX.

John Kittelsrud wrote step-by-step instructions on a way to connect R/C servos to LEGOs.

Allen Martin wrote something about H8 interrupts.

Johann Borenstein has written a book entitled "Where Am I? -- Systems and Methods for Mobile Robot Positioning". While it's about non-LEGO robots, it's got quite a bit of applicable information. This book, which you can download for free, contains nearly 300 pages with *great* illustrations. It's a pretty weighty tome, though (comes in at over 13.5MB, but is in PDF (Adobe Acrobat) format).

Terry King has made some homemade LED bricks. The two pictures 2leds.jpg and 2ledcopp.jpg are pretty self-explanatory.

Mathias Uhr reports that the power circuits are different between revisions. He writes: I disassembled all versions of the rcx bricks and had a look at their power circuits. Here are the results:

Electuur has an I2C Interface for Lego RCX 'Brick'.

Repairing a damaged RCX button using a spare rubber button of a cheap calculator.

Firmware

W. Craig Trader writes:

Since the RIS software downloads the firmware to the RCX brick, it should be possible to identify the firmware and disassemble it; I'm guessing that ...\Firm\Firm0309.lgo is the firmware file. I looked at it and it appears to be in Motorola S-record format.

Matthew Cross writes: I have sucessfully built a set of binutils that can disassemble the RCX firmware.

  1. Download binutils source: ftp://prep.ai.mit.edu/pub/gnu/binutils-2.9.1.tar.gz
  2. Run the configure script with the option --target=h8300-hitachi-hms. I also added --prefix=/usr/local to install it under /usr/local. Then run 'make' and 'make install'
  3. To disassemble the RCX firmware: /usr/local/bin/h8300-hitachi-hms-objdump -b srec -m h8300 --disassemble-all Firm0309.lgo

I just disassembled it last night and will be starting to analyze it today. I'll be very interested in trading notes with anyone also working on this. Be sure to snarf a copy of the h8/300 manuals.

I believe that they would operate the chip in mode 2 - Expanded mode with on-chip ROM. So the memory map should be the center one on page 60 of h83297h.pdf (the hardware manual). It seems that they have an on-chip ROM because there is no external ROM on the RCX board, and also note that the S-Records load at address 0x8000, which lines up with where the external address space starts on this memory map.

Olof Åstrand has similar instructions for NT users:

  1. download cygnus cygwin32.
  2. Then download the gnu binutils.
  3. Install the cygnus package. Create a /bin directory. Copy sh.exe to there.
  4. Unpack the gnu-binutils. Winzip will do this for you. I think you have to help it with the extentions ( .tar.gz or .tgz).
  5. In a Cygnus-shell, at the binutils toplevel, type
    ./configure --target=3Dh8300-hms-coff
    make
    make install
    

I did get some errors when compiling ldemul.c but the rest of the tools installed fine. They install under /usr/local/bin. This is on your default disk. To access other disks use //c //d .

Copy Firm0309.lgo firmware.srec Then do /usr/local/bin/h8300-hms-coff-objdump -m h8300 -D --no-show-raw-insn firmware.srec > firmware.s

Now you should have your firmware dump.

Kekoa has instructions on getting a complete ROM image. He also has a writeup on how to download new firmware to the RCX.

Dick Swan measured the time it takes to execute an RCX instruction.


Send suggestions for improvement to
Russell Nelson
Last modified: Fri Jan 19 14:08:35 EST 2007